#!python2 #coding: utf-8 import sys import numpy as np import pylab as plt from matplotlib.animation import FuncAnimation from matplotlib.lines import Line2D from matplotlib import animation fig, ax = plt.subplots() fig.set_tight_layout(True) plt.rcParams['animation.ffmpeg_path'] =u'D:\\Python27_64\\Scripts\\ffmpeg.exe' FFwriter = animation.FFMpegWriter() plt.rcParams.update({'font.size':10})
fh=open("pmf.dat") xlist=[] ylist=[] barlist=[] xydict={} for line in fh.readlines()[1:]: x,y,bar=line.strip().split() xydict[x]=y x,y,bar=map(float,line.strip().split()) xlist.append(x) ylist.append(y)
barlist.append(bar)
#http://www.tuicool.com/articles/Z7BzY3V #plt.legend(loc=2,prop={'size': 9}) plt.xlabel('Z (Angstrom)') plt.ylabel ('Free Energy (kCal/mol)') plt.xlim(0,12) plt.xticks([0,2,4,6,8,10,12]) plt.ylim(0,12) plt.yticks([0,2,4,6,8,10,12]) # plt.plot(xlist,ylist,linewidth = 2.5, color = 'r')
# how to set line # Line2D line = Line2D([xlist[0]],[ylist[0]])